<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./css/zhuce.css">
    <title>Document</title>
</head>
<body>
    <div class="container">
        <a class="logo" href="https://store.logitech.com.cn/images/logo1.png"></a>
    </div>
    <div> 
        <div class="login-box">
            <h4 class="login-title"><span class="name">账户注册</span> </h4>
            <div id="LoginFrom" class="login-form">
                <div class="form-list">
                    <input class="input-text" id="userzname">
                    <i class="icon-login-user">账号</i>
                    <i class="icon-close"></i>
                </div>
                <div class="form-list">
                    <input class="input-text" id="password"   >
                    <i class="icon-login-password">密码</i>
                    <i class="icon-close"></i>
                </div>
            </div>
            <button id="btn" class="user-default-btn" href="javascript:void(0);" style=" width: 100px;">注册</button> 
        </div>
    </div>
    <div class="footer-box">
        <div class="container">
            <p>罗技官方商城由罗技（中国）科技有限公司授权双齐国际贸易（上海）有限公司负责经营 2021 , all rights reserved</p>
            <p>
                <a >罗技官方网站</a>
                <a >联系方式</a>
                <a >隐私声明</a>
                <a >用户服务协议</a>
                
                <a >沪ICP备12002604号-1</a>
            </p>
        </div>
    </div>

    <!-- js -->
    <script src="./javascripts/jQuery.js"></script>
    <script>
        $(function(){
            $("#btn").click(function(){
                $.ajax({
                    url:"http://localhost/xiangmu/register.php",
                    data:{
                        username:$("#userzname").val(),
                        password:$("#password").val()
                    },
                    dataType:"json",
                    type:"POST"
                })
                .then(function(res){
                console.log(res)

                   if(res.type === "注册成功"){
                        $(location).attr("href","http://localhost:3000/denglu.html")
                   }else{
                       alert("账号重名请重新注册")
                   }
                });
            });
        })
    
    </script>
</body>
</html>